<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #app{
            -moz-user-select: none;
            list-style: none;
            -webkit-user-select: none;
        }
    </style>
</head>
<body>
    <div id="app">
      <fieldset>
          <div>
             图片 <input type="file" :change="img">
          </div>
          <div>
             昵称 <input type="text" placeholder="请填写" v-model="nickname">
          </div>
          <div>
              <button @click='add'>添加</button>
          </div>
      </fieldset>
      <ul>
          <li v-for="(item,i) in list" >
              <img :src="item.img" alt="" :style="{width:w,height:'150px'}"> 
              <a>{{item.nam}}</a>
              <button @click="del(i)">删除</button>
          </li>
      </ul>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        Vue.config.productionTip =false
        var vm=new Vue({
            el:"#app",
            data(){
                return{
                    w:'100px',
                    img:"",
                    nickname:"",
                    list:[
                        {
                        img:"https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2095754633,414445753&fm=26&gp=0.jpg",
                        name:"simba"
                      },
                      {
                        img:"https://dss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2593260054,368000627&fm=26&gp=0.jpg",
                        name:"ace"
                      },
                      {
                        img:"https://dss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2593260054,368000627&fm=26&gp=0.jpg",
                        name:"roger"
                      }

                    ]
                    
                }
            },
            methods:{
               add(){
                   this.list.unshift({
                       img:this.img,
                       name:this.nickname
                   })
               },
               del(i){
                   console.log(i)
                   this.list.splice(i,1)
               }

            },
            mounted(){

            },
            created(){

            }

        })
        setTimeout(() => {
            vm.$mount("#app")
            
        }, 500);
        

    </script>
</body>
</html>